package neusoft.yuejian_11.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import neusoft.yuejian_11.base.BaseListAdapter;
import neusoft.yuejian_11.R;
import com.squareup.picasso.Picasso;

import java.util.List;

import neusoft.yuejian_11.bean.ClubInformBean;
import neusoft.yuejian_11.viewHolder.InfomListViewHolder;

import static neusoft.yuejian_11.interF.Const.BASE_URI;

/**
 * Created by NEUSOFT on 2017/10/6.
 */

public class CInforListAdapter extends BaseListAdapter {

      public CInforListAdapter(Context context, List data) {
      super(context, data);
}

    @Override
    protected RecyclerView.ViewHolder onCreateVH(ViewGroup parent, LayoutInflater layoutInflater, int viewType) {
        View itemView=layoutInflater.inflate(R.layout.item_infor,parent,false);
        InfomListViewHolder holder=new InfomListViewHolder(itemView);
        return holder;
    }

    @Override
    protected void onBindVH(RecyclerView.ViewHolder holder, List data, int position) {

        final ClubInformBean clubInformBean = (ClubInformBean)data.get(position);
        InfomListViewHolder infomListViewHolder=(InfomListViewHolder) holder;
        final String cinforname =clubInformBean.getC_name();
        String cinforinfo=clubInformBean.getCi_info();
        String cinfortime=clubInformBean.getCi_createtime();
        String pic=BASE_URI+"clubphoto/"+clubInformBean.getC_pic();
        Picasso.with(context).load(pic).into(InfomListViewHolder.imageView);
        infomListViewHolder.infornameView.setText(cinforname);
        infomListViewHolder.inforinfoView.setText(cinforinfo);
        infomListViewHolder.infortimeView.setText(cinfortime);
    }

}
